﻿using System;
using System.Web.Security;

namespace eCommerce.CMS
{
    public partial class AdminMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            MembershipUser myObject = Membership.GetUser();
            if (myObject != null)
            {
                var getType = Roles.GetRolesForUser(myObject.UserName.ToString());
                // Response.Write(getType);
                string newType = Convert.ToString(getType[0]);
                if (newType == "administrator")
                {
                    string userName = myObject.UserName;
                    loginusername.Text = "<span>Hi " + userName + "</span>";
                   
                }
                else
                {
                    MenuPanel.Enabled = false;
                    MenuPanel.Visible = false;
                    
                    // Response.Redirect("login.aspx");
                }
            }
            else
            {
                MenuPanel.Enabled = false;
                MenuPanel.Visible = false;
                //Response.Redirect("login.aspx");
            }
        }
    }
}